/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mydatastore.mysql.client;

import com.mydatastore.StatementUnit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author DTIT
 */
public class GetClientById extends StatementUnit {
  
  private int id;

  public GetClientById(int id) {
    this.id = id;
  }

  @Override
  public void composeSql() {
    append("SELECT * FROM client WHERE client_id = ?");
  }

  @Override
  public PreparedStatement getPreparedStatement(Connection connection) throws SQLException {
    PreparedStatement st = connection.prepareStatement(getSql());
    st.setInt(1, id);
    return st;
  }
}
